-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix ClipQuantFusion crash when Clip has multiple input edges #26923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
| if (!graph_utils::CanRemoveNode(graph, node, logger)) { | ||
| return false; | ||
| } |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CanRemoveNode check should ideally be performed earlier in the SatisfyCondition method, before checking the next_node. This ordering is more efficient because if the current node cannot be removed, there's no need to validate the following QuantizeLinear node. Consider moving this check to after line 89 (after the initial node validation) and before line 92 (before the next_node checks).
From AISummaryThis PR fixes a runtime exception in the Key Changes
Review AnalysisCorrectness
Performance
ConclusionThis is a straightforward and correct bug fix. The inclusion of a regression test gives high confidence in the solution. LGTM. |
|
/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline |
|
Azure Pipelines successfully started running 4 pipeline(s). |
adrianlizarraga
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
Motivation
ClipQuantFusion in clip_quantizelinear.cccallsgraph_utils::RemoveNode()without first checkinggraph_utils::CanRemoveNode(). When a Clip node has min/max inputs from DequantizeLinear nodes (instead of initializers), it has multiple input edges.RemoveNode()throws exception:Fix:
Added
CanRemoveNode()check toClipQuantFusion::SatisfyCondition()to skip nodes that cannot be safely removed.Test:
Added
ClipQuantFusion_MultipleInputEdgestest that creates a Clip node with min from a DQ node (2 input edges) and verifies the optimizer doesn't crash.